package com.wuwei.elearning.messageQueen;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PreDestroy;


/**
 * Spring configuration for the message queue
 */
@Configuration
public class MessageQueueConfig {
    
    /**
     * Create the message queue bean
     * 
     * @return The message queue instance
     */
    @Bean
    public MessageQueue messageQueue() {
        return MessageQueueFactory.getInstance();
    }
    
    /**
     * Shutdown the message queue when the application is stopping
     */
    @PreDestroy
    public void shutdown() {
        MessageQueueFactory.shutdown();
    }
} 